﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace ArkanoidX.Objects
{
    public class BaseComponent : DrawableGameComponent
    {
        public enum BaseState
        {
            Unmounted,
            Mounted,
        }

        protected BaseState _baseState;

        public BaseState BState
        {
            get { return _baseState; }
        }

        public BaseComponent(Game game)
            : base(game)
        {
            _baseState = BaseState.Unmounted;
        }

        public virtual void AddToLayer(Layer layer)
        {
            if (_baseState == BaseState.Unmounted)
            {
                ((MainGame)Game).AddComponent(this, layer);
                _baseState = BaseState.Mounted;
            }
        }

        public virtual void RemoveFromGame()
        {
            if (_baseState == BaseState.Mounted)
            {
                ((MainGame)Game).RemoveComponent(this);
                _baseState = BaseState.Unmounted;
            }
        }
    }
}
